define [
  'underscore'
], (_)->

  _.mixin
    generateOptions: (collection, propId, propName, sizeLimit) ->
      optionsCont = []
      options = {}
      if collection and collection.models and collection.models.length
        propId = "id"  unless propId
        propName = "nome"  unless propName
        sizeLimit = 60  unless sizeLimit
        $.each collection.models, (i, model) ->
          if model.get(propName)
            model.set propName, model.get(propName).substr(0, sizeLimit) + "..."  if model.get(propName).length > sizeLimit
            options = {}
            options[model.get(propId)] = model.get(propName)
            optionsCont.push options

      optionsCont

    removeItem: (list, item) ->
      newList = []
      _.each list, (el, i) ->
        newList.push el  unless _.isEqual(el, item)

      list = newList
      list
